package org.nanotek.key;

import java.util.UUID;

@SuppressWarnings("serial")
public class GenericUUIDService extends AbstractKeyService<UUID, Class<UUID>> {

	@Override
	public UUID getKey() {
		return UUID.randomUUID();
	}

	public UUID getKey(String val) 
	{ 
		return UUID.fromString(val);
	}
	
	public UUID getKey (byte[] bytes) 
	{ 
		return UUID.nameUUIDFromBytes(bytes);
	}

	@Override
	public Class<UUID> get() {
		return UUID.class;
	}
	
	public static void main(String[] args) 
	{ 
		KeyService<UUID , Class<UUID>> keyUUIDService =  new GenericUUIDService();
		System.out.println(keyUUIDService.getKey());
		System.out.println(keyUUIDService.getKeyClass());
	}
}
